package com.qf.air.controller;

import com.qf.air.entity.District;
import com.qf.air.service.DistrictService;
import com.qf.air.util.R;
import com.qf.air.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 维多利加
 * @Date: 2021/3/24 11:10
 */
@RestController
@RequestMapping("/district")
@CrossOrigin(allowCredentials = "true")
public class DistrictController {

    @Autowired
    private DistrictService districtService;


    @RequestMapping(value = "/list",method = RequestMethod.GET)
    public ResultVO list(){
        //1.调用service层查询数据
        List<District> all = districtService.findAll();
        //2.返回数据
        return R.ok(all);
    }

}
